#!/usr/bin/python
# -*- coding: utf-8 -*-
arr=raw_input()
li=arr
len=len(set(li))
if len>2:
    print 0
else:
    print len